package es.juanc.crypto;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import javax.xml.bind.annotation.adapters.HexBinaryAdapter;

public class DigestMain {

	/**
	 * @param args
	 * @throws NoSuchAlgorithmException
	 */
	public static void main(String[] args) throws NoSuchAlgorithmException {

		MessageDigest digestor = MessageDigest.getInstance( "MD5" );

		byte[] digest = digestor.digest( "texto a digerir".getBytes() );

		HexBinaryAdapter adapter = new HexBinaryAdapter();
	    String message = adapter.marshal( digest );

	    System.out.println( new String( digest ) + " -> " +  message );
	}
}